import Vue from 'vue'
import Vuex from 'vuex'
import fa from "element-ui/src/locale/lang/fa";

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    userToken:'',
    isShowAll:false
  },
  mutations: {
    isLogin(state){
      if (localStorage.getItem('token'))
      {
        state.isShowAll = true

        this.state.userToken = localStorage.getItem('token')

      }
      else
      {
        state.isShowAll = false
      }
    },
    setUserToken(state,token){
      state.userToken = token
      localStorage.setItem('token',token)

    },
    showAll(state)
    {
      state.isShowAll = true
    },
    hideAll(state)
    {
     state.isShowAll = false
    },
    logout(state){
      state.userToken = ''
      localStorage.removeItem('token')
      this.state.isShowAll= false
    }
  },
  actions: {
  },
  modules: {
  }
})
